# import requests
# import random

# urls = [f'https://httpbin.org/get?value={random.randint(1, 10)}' for i in range(10)]
#
# requested_url = set()
#
# for url in urls:
#     if url not in requested_url:
#         requested_url.add(url)
#         res = requests.get(url)
#         print(res.json())
#
#     else:
#         print(f'{url}已经请求过了')


import requests
import random
import hashlib
import json

url = f'https://httpbin.org/post'

datas = [{'id' : 101,'value' : random.randint(1, 10)} for i in range(10)]
items = set()
for data in datas:
    data_hash = hashlib.md5(json.dumps(data).encode()).hexdigest()
    if data_hash not in items:
        items.add(data_hash)
        res = requests.post(url, data=json.dumps(data))
        print(res.json())
    else:
        print(f'请求重复！')